package org.iot.iotserver.http.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class YAbstractServlet extends HttpServlet {

    protected void responseJsonData(HttpServletResponse resp, String jsonStr) throws IOException {
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().write(jsonStr);
    }

    protected void responseJsData(HttpServletResponse resp, String jsonStr) throws IOException {
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("application/javascript;charset=utf-8");
        resp.getWriter().write(jsonStr);
    }

}
